<%= render 'base' %>

<div class="subnav">
  <nav class="subnav-links">
    <a href="<%= admin_users_path %>" class="subnav-item"><%= t("admin.All") %></a>
  </nav>
  <div class="subnav-search float-left">
    <form action="" method="GET">
      <input type="search" name="q" class="form-control subnav-search-input" value="<%= params[:q] %>">
      <%= icon_tag "search", class: "subnav-search-icon" %>
    </form>
  </div>
</div>

<div class="admin-admin_users">
  <table class="table table-striped">
    <tr class="head">
      <td>Id</td>
      <td></td>
      <td><%= t("activerecord.attributes.user.name") %></td>
      <td><%= t("activerecord.attributes.user.followers_count") %></td>
      <td><%= t("created_at") %></td>
      <td class="opts"></td>
    </tr>
    <% @users.each do |item| %>
    <tr class="<%= cycle("","even") %> <%= "deleted" if item.deleted? %>">
      <td><%= link_to item.id, admin_user_path(item.id) %></td>
      <td style="width: 32px"><%= user_avatar_tag(item, style: :small, link: false) %>
      <td>
        <div><%= link_to item.name, admin_user_path(item.id) %></div>
        <div class="mt-1 text-gray"><%= item.slug %></div>
      </td>
      <td><%= item.followers_count %></td>
      <td class="text-gray"><%= l(item.created_at) %></td>
      <td class="opts">
        <%= link_to icon_tag("pencil"), edit_admin_user_path(item.id) %>
        <%= link_to icon_tag("trash"), admin_user_path(item.id), method: :delete, 'data-confirm' => t("admin.Are you sure delete this item?") %>
        <!-- PRO-begin -->
        <% feature_for(:soft_delete) do %>
          <% if item.deleted? %>
            <%= link_to icon_tag("restore"), restore_admin_user_path(item.id), method: :post, 'data-confirm' => t("admin.Are you sure restore this item?") %>
          <% end %>
        <% end %>
        <!-- PRO-end -->
      </td>
    </tr>
    <% end %>
  </table>
  <%= paginate @users %>
</div>
